# Relies on the NETPBM tools, if you don't recognise them.
# Generated data just gets sent to stdout, where you'll cut&paste 
# into your assembler file.
# --
# Chris Baird,, <chris.j.baird@gmail> 2021
#
# xterm -fa PetMe64 -fs 6
# clear; printf '%b\n' $(printf '\\x%x\x0a' {32..127})

FOO=/tmp/$$.pnm

anytopnm $1 >$FOO
c=100
#8-bit wide fonts like CBM's
#for x in `seq 008 8 759`
#f7-bit wide like Apple2
for x in `seq 008 8 767`
do
   pamcut <$FOO -left $x -top 0 -width 8 -height 6 >chars_${c}.pnm
   c=$(( $c + 1))
done

for i in chars_*
do 
    pamthreshold $i 2>/dev/null|pnminvert|pnmflip -tb |pamtopnm|pbmtoxbm
done|grep x|sed -e 's/};/},/' -e 's/^ /    {/'

rm -f C_chars* chars_*

